package dm.com.dmexamples;

import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import java.io.File;
import java.net.URI;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by Damon on 2017/9/20.
 */

public class FrgGlide extends Fragment {

    ImageView img;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.frg_glide, container, false);
        img = view.findViewById(R.id.img_4_video);
        img.postDelayed(new Runnable() {
            @Override
            public void run() {
                String filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/zl.mkv";
                Glide.with(getContext()).load(Uri.fromFile(new File(filePath))).asBitmap().placeholder(R.mipmap.ic_launcher_round).into(img);
            }
        }, 500);
        return view;
    }

}
